package com.guess.study.designpattern.templatemethod;

/**
 * Created by tianran on 2019-06-14.
 */
public class ConcreteClassB extends AbstractClass {
    @Override
    protected void doSomething() {
        System.out.println("ConcreteClassB doSomething()");
    }

    // 使用父类doAnything()的默认实现

    @Override
    protected void dependOnHook() {
        System.out.println("ConcreteClassB dependOnHook()");
    }

    /**
     * 覆写钩子方法，改变默认实现，改变公共部分（模板方法）的行为，dependOnHook()不会被调用
     *
     * @return
     */
    @Override
    protected boolean hook() {
        System.out.println("ConcreteClassB hook()");
        return false;
    }
}
